﻿<%@ Page Language="C#" AutoEventWireup="true" Inherits="CustomerManagement_AddPresentCoupon" Codebehind="AddPresentCoupon.aspx.cs" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>无标题页</title>
    <script type="text/javascript">
       function setVIPValue(p)
       {
            var gk=p.split("|");
            document.getElementById("hidCustomer").value=gk[0] + "|" + gk[2] ;
            document.getElementById("lblCustomer").innerText =gk[0] + " " + gk[2]; 
       }
       function SelectCoupon()
       {
            var result="";
            result = window.showModalDialog('../BaseData/SelectCoupon.aspx', window,'status:off;center=yes;edge:raised;dialogHeight:500px;dialogWidth:750px;help:0;resizable:0;scrollbar=0');
            if (result != null && result != '' && typeof result != 'undefined')
            {
                var selectedCouponCode = "";
                var selectResult = result.split("$");
                for(var i=0;i<selectResult.length;i++)
                {
                    var temp = selectResult[i].split("|");
                    if(temp.length==2)
                    {
                        selectedCouponCode += temp[0] + " ";
                    }
                }
                document.getElementById("hidCoupon").value = result;
                document.getElementById("lblCoupon").innerText = selectedCouponCode;
            }
            else
            {
                document.getElementById("hidCoupon").value = "";
                document.getElementById("lblCoupon").innerText = "";
            }
       }
    </script>
    <script type="text/javascript" src="../Include/Js/OpenWindow.js"></script>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:Button ID="btnSubmit" runat="server" Text="保存" OnClick="btnSubmit_Click" />
        <asp:Button ID="btnCancel" runat="server" Text="取消" OnClick="btnCancel_Click" /><br />
        <br />
        <asp:DataList ID="dlistPresentCoupon" runat="server" OnItemCommand="dlistPresentCoupon_ItemCommand">
            <HeaderTemplate>
                <table>
                    <tr>
                        <td>
                        
                        </td>
                        <td>
                            用户代码
                        </td>
                        <td>
                            用户名称
                        </td>
                        <td>
                            礼券号
                        </td>
                        <td>
                            礼券面值
                        </td>
                    </tr>
            </HeaderTemplate>
            <ItemTemplate>
                    <tr>
                        <td>
                            <asp:Button ID="btnDelete" runat="server" Text="删除" CommandName="del" />
                        </td>
                        <td>
                            <asp:Label ID="lblCustomerCode" runat="server" Text='<%# Eval("CustomerCode")%>'></asp:Label>
                        </td>
                        <td>
                            <asp:Label ID="lblCustomerName" runat="server" Text='<%# Eval("CustomerName")%>'></asp:Label>
                        </td>
                        <td>
                            <asp:Label ID="lblCouponCode" runat="server" Text='<%# Eval("CouponCode")%>'></asp:Label>
                        </td>
                        <td>
                            <asp:Label ID="lblCouponAmount" runat="server" Text='<%# Eval("CouponAmount")%>'></asp:Label>
                        </td>
                    </tr>
            </ItemTemplate>
            <FooterTemplate>
                </table>
            </FooterTemplate>
        </asp:DataList></div>
        <br />
        用户：<input id="btnSelectCustomer" type="button" value="选择会员" onclick="SearchVIP('../');" />
        <br />
        &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
        <br />
        &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
        <asp:Label ID="lblCustomer" runat="server"></asp:Label>
        <br />
        <br />
        礼券：<input id="btnSelectCoupon" type="button" value="选择礼券" onclick="SelectCoupon()" />&nbsp;<br />
        &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;
        <br />
        &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
        <asp:Label ID="lblCoupon" runat="server"></asp:Label>
        <br />
        <br />
        <asp:Button ID="btnAdd" runat="server" Text="添加" OnClick="btnAdd_Click" />
        <br />
        <input id="hidCustomer" type="hidden" runat="server" />
        <input id="hidCoupon" type="hidden" runat="server" />
    </form>
</body>
</html>
